package com.ericzong.util.ui;

import javax.swing.SwingUtilities;

import org.jdesktop.swingx.JXFrame;

public abstract class AbstractJXFrame extends JXFrame
{
	private static final long serialVersionUID = 1L;

	public AbstractJXFrame()
	{
		this("");
	}

	public AbstractJXFrame(String title)
	{
		this(title, false);
	}

	public AbstractJXFrame(String title, boolean exitOnClose)
	{
		super(title, exitOnClose);
		SwingUtilities.invokeLater(() ->
		{
			init();
		});
	}

	protected final void init()
	{
		LocationUtils.setFrameSizeByScreenRatio(this, 0.75);
		LocationUtils.setFrameCenter(this);

		createContent();

		setVisible(true);
		validate();
	}

	protected abstract void createContent();

}
